﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Ver1.Controllers
{
    public class SanPhamController : Controller
    {
        BanHang_Pallet db = new BanHang_Pallet();
        //
        // GET: /SanPham/
        public ActionResult Index()
        {

            var model = db.Sanphams;

            return View(model);
        }

        public ActionResult Detail(string id)
        {

            var model = db.Sanphams.Find(id);

            return View(model);
        }

        public ActionResult Bycategory(int id)
        {

            List<Sanpham> model = db.Sanphams.Where(c=>c.LoaiId==id).ToList();
            if (model.Count<0) 
            { 
                ViewBag.thongbao = "Không có sản phẩm thuộc loại này"; 
            }
            
            return View(model);
        }
    }
}